<template>
  <div id="app">
    <a-config-provider :locale="zh_CN">
      <router-view />
    </a-config-provider>
  </div>
</template>

<script>
import zh_CN from 'ant-design-vue/lib/locale-provider/zh_CN';
import moment from 'moment';
import 'moment/locale/zh-cn';
import storage from "store";
import { ACCESS_TOKEN } from "@/store/mutation-types";
moment.locale('zh-cn');
export default {
  name: 'App',
  data () {
    return {
      zh_CN
    }
  },
  components: {
  },
  mounted () {
    const token = storage.get(ACCESS_TOKEN)
    console.log('token',token);
    
    if (token) {
      this.areaList()
    }
  },
  methods: {
    //所属区域
    areaList () {
      this.$axios({
        url: '/area/list',
        method: 'get',
        cancel: {
          _self: this
        },
      }).then(res => {
        console.log(res.data);
        let areaList = (res.data && res.data.areaList || []).map(v => {
          v.label = v.name
          v.value = v.id
          return v
        })
        this.$store.commit('setAreaList', areaList)
      })
    }
  }
}
</script>

<style lang="less" scoped>
#app {
  width: 100%;
  height: 100%;
}
</style>
